<!DOCTYPE html>
<html>
<#assign contextPath = request.contextPath/>
<head>
<meta charset="UTF-8">
<title>修改投票</title>
<link href="${contextPath}/css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript"
	src="${contextPath}/js/jquery-3.0.0.min.js"></script>
<link href="${contextPath}/css/toastr.css" rel="stylesheet" />
<script src="${contextPath}/js/toastr.js"></script>
</head>

<body>
	<script>
		var msg = '${msg!}';
		var parammsg = '${Parameters.msg!}';
		if (msg != '') {
			toastr.info(msg);
		} else if (parammsg != '') {
			toastr.info(parammsg);
		}
	</script>
	<#include "/common/nav.html">
	<div class="container-fluid">
		<div class="row">
			<#include "/common/left.html">
			<div class="col-sm-9">
				<ol class="breadcrumb">
					<li><a href="#">主页</a></li>
					<li class="active">修改投票</li>
				</ol>
				<form class="form-horizontal" action="updatevote.action"
					method="post">
					<input type="hidden" name="e.vid" value="${e.vid}" /> <input
						type="hidden" name="e.vturnout" value="${e.vturnout}" />
					<div class="form-group">
						<label for="title" class="col-sm-2 control-label">投票类型</label>
						<div class="col-sm-10">
							<select class="form-control" name="e.voteType.vtId"
								style="width: 100px;"> <#list vtlist as vt>
								<option<#if vt.vtId == e.voteType.vtId>selected</#if>
									value="${vt.vtId}">${vt.vtName}</option> </#list>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label for="title" class="col-sm-2 control-label">投票标题</label>
						<div class="col-sm-10">
							<input type="text" name="e.vtitle" class="form-control"
								id="title" placeholder="投票标题" value="${e.vtitle}">
						</div>
					</div>
					<#list e.voteOptions as op>
					<div class="form-group ops">
						<label for="options1" class="col-sm-2 control-label">选项${op_index+1}</label>
						<div class="col-sm-10">
							<input type="hidden"
								name="e.voteOptions.makeNew[${op_index}].voId"
								value="${op.voId}" /> <input type="text"
								name="e.voteOptions.makeNew[${op_index}].voText"
								class="form-control" id="options1" value="${op.voText}"
								placeholder="选项${op_index+1}" required>
						</div>
					</div>
					</#list>
					<div class="form-group" id="addop">
						<div class="col-sm-offset-2 col-sm-10">
							<button type="button" class="btn btn-link" onclick="addop()">新增选项</button>
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-offset-2 col-sm-10">
							<button type="submit" class="btn btn-info">修改</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
	<script>
		function addop() {
			var length = $(".ops").length;
			length++;
			var html = "<div class='form-group ops'>";
			html += "<label for='options" + length + "' class='col-sm-2 control-label'>选项"
					+ length + "</label>";
			html += "<div class='col-sm-10'>";
			html += "<input type='text' name='e.voteOptions.makeNew["
					+ (length - 1)
					+ "].voText' class='form-control' id='options" + length
					+ "' placeholder='选项" + length + "' required>";
			html += "</div></div>";
			$("#addop").before(html);
		}
	</script>
</body>

</html>